<?php
/**
 * 角色列表参数
 *
 * @author: WangBin
 * @date: 2021/7/26
 * @mail: <849850352@qq.com>
 */
namespace App\Params\Backend;

use App\Params\Param;

class RoleListParam extends Param
{
    public $name = '';
    public $page = 1;
    public $page_size = 20;

    public function rules()
    {
        return [
            'name' => 'nullable|string',
            'page' => 'integer',
            'page_size' => 'integer'
        ];
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name): void
    {
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getPage()
    {
        return $this->page > 0 ? $this->page - 1 : 0;
    }

    /**
     * @param mixed $page
     */
    public function setPage($page): void
    {
        $this->page = $page;
    }

    /**
     * @return mixed
     */
    public function getPageSize()
    {
        return $this->page_size;
    }

    /**
     * @param mixed $page_size
     */
    public function setPageSize($page_size): void
    {
        $this->page_size = $page_size;
    }
}